/*
 * =====================================================================================
 *
 *       Filename:  results_in_database.h
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  2013年07月16日 19时13分34秒
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Xie Yanping (), 
 *        Company:  www.Qihoo.net
 *
 * =====================================================================================
 */

#ifndef __Imlogs_reulst_in_database_h__
#define __Imlogs_reulst_in_database_h__

#include <boost/scoped_ptr.hpp>
#include <vector>
#include "database/simple_db_pool.h"

namespace imlogs {
class ResultsInDatabase {
 public:
  struct DialogueData {
    int64_t sender_;
    int64_t receiver_;
    int32_t count_;
    int32_t time_;
  };
  typedef std::vector<DialogueData> DialogueArray;

  static ResultsInDatabase& GetInst();
  // date - 日期
  // time - 最大为多长时间
  int GetBreakStatistics(DialogueArray *dialogue_array, const std::string& date, int time = 600);

 private:
  ResultsInDatabase();
  boost::scoped_ptr<base::SimpleConnectionPool> database_pool_;
};

}

#endif //__Imlogs_reulst_in_database_h__
